package com.cacho.s2b.lesson.learn;

import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

/**
 * @Description URLDecoder类提供了一种简单的方式来解码URL编码的字符串，将其还原成原始的字符串形式。
 * @Author LingWei
 * @date 2023/12/31
 **/
public class LearnURLDecoder {
    public static void main(String[] args){
        String urlPath = "https://www.baidu.com/s?wd=java%20URLEncoder&rsv_spt=1&rsv_iqid=0x9a38a1e2000fc5e8&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=21002492_29_hao_pg&rsv_dl=tb&rsv_enter=0&oq=java%2520URLDecoder&rsv_btype=t&rsv_t=991boYRqohU8FSiG64dOdPf%2BprzGJK19dCFVSn5YrBhXyRJhI4da9TV4pm4T2m4XthCJqOgS4%2Bcd&rsv_pq=8473dbbf000387aa&inputT=1186&rsv_sug3=51&rsv_sug1=41&rsv_sug7=100&rsv_n=2&rsv_sug4=1232";
        urlPath = URLDecoder.decode(urlPath, StandardCharsets.UTF_8);
        System.out.println("解码url编码的字符串后："+urlPath);
    }
}
